package com.amkor.study.direct.rpc;

import java.util.List;
import java.util.Map;

import org.apache.commons.fileupload.FileItem;

import com.amkor.study.direct.dao.DirectDao;
import com.amkor.study.direct.dao.DirectDaoJdbc;
import com.amkor.study.direct.domain.Personal;
import com.amkor.web.common.dao.BeanManager;
import com.google.gson.JsonObject;
import com.softwarementors.extjs.djn.config.annotations.DirectAction;
import com.softwarementors.extjs.djn.config.annotations.DirectFormPostMethod;
import com.softwarementors.extjs.djn.config.annotations.DirectMethod;

@DirectAction(action="callDirectHelperSvc")
public class DirectRpcServiceImpl {
	
	private DirectDao directDao = BeanManager.getAppCtx().getBean("directDao", DirectDaoJdbc.class);
	
	@DirectMethod(method="getPersonalAllRPC")
	public List<Personal> getPersonalAll() throws Exception {
		return directDao.getPersonalAll();
	}
	
	@DirectFormPostMethod(method="createPersonalRPC")
	public void createPersonal(Map<String, String> formFields, Map<String, FileItem> fileFields) throws Exception {
		System.out.println(123456);
		System.out.println("createParams ====>"+formFields);
		directDao.createPersonal(formFields, fileFields);
		
	}
		
	@DirectMethod(method="updatePersonalRPC")
	public void updatePersonal(JsonObject paramObj) throws Exception {
		System.out.println("updateParams ====>"+paramObj);		
	}
	
	@DirectMethod(method="deletePersonalRPC")
	public void deletePersonal(JsonObject paramObj) throws Exception {
		System.out.println("destroyParams ====>"+paramObj);				
	}
	
}
